import { Select } from 'antd';
import { Option } from 'antd/lib/mentions';
import { useState } from 'react';
import an58 from '@mmstudio/an000058';
import api from '../../../atoms/api';
import Kcbtitle from './kcbtitle';
import Kcblist from './kcblist';
import { IName } from './index.page';
import { IData, Message as M1, Result as R1 } from '../../api/teachgl/kcb/kcbquery.api';

export default function Content({ initialdata }: {
	initialdata: IName[];
}) {
	const [data, setdata] = useState([] as IData[]);
	return <>
		<Kcbtitle />
		技创辅年级：
		<Select style={{ minWidth: '20rem' }} onChange={async (e) => {
			const class_id = e as string;
			const ret = await an58<R1, M1>(api['/api/teachgl/kcb/kcbquery'], 'get', { class_id });
			setdata(ret);
		}}>
			{initialdata.map((it) => {
				return <Option key={it.class_id} value={it.class_id}>{it.name}</Option>;
			})}
		</Select>
		<Kcblist data={data} />

	</>;
}





